Skip to content

Don't use hardcoded AMD64 architecture for paths - #350

Merged
johnmccrae merged 5 commits into
18-Stablefrom
jfm/chef18-arch-update
Oct 31, 2025
Merged

johnmccrae merged 5 commits into
18-Stablefrom
jfm/chef18-arch-update

Conversation

@johnmccrae

@johnmccrae johnmccrae commented Oct 31, 2025 •

Copy link
Copy Markdown
Contributor

Description

The initial #349 PR cleaned up a lot of problems with the chef-powershell build, but retained the practice of using hardcoded architecture paths (which at the moment is only AMD64). This PR is intended to future proof the code by retrieving the architecture dynamically (but still falls back on AMD64).

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
@johnmccrae
johnmccrae requested a review from Copilot October 31, 2025 18:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a hardcoded architecture value ("AMD64") throughout the codebase by replacing it with dynamic architecture detection using the PROCESSOR_ARCHITECTURE environment variable. The changes ensure proper support for different processor architectures while maintaining backward compatibility by defaulting to "AMD64" when the environment variable is not set.

Key Changes:

  • Replaced hardcoded "AMD64" strings with dynamic architecture detection using ENV["PROCESSOR_ARCHITECTURE"] || "AMD64"
  • Added null checks for Gem.loaded_specs["chef-powershell"] to prevent potential nil reference errors
  • Updated build scripts and workflows to use dynamic architecture paths

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
chef-powershell/spec/unit/powershell_exec_spec.rb Added gem spec null check and dynamic architecture detection in test setup
chef-powershell/lib/chef-powershell/pwsh.rb Replaced hardcoded AMD64 with dynamic arch detection in multiple locations, added gem spec validation
chef-powershell/lib/chef-powershell/powershell_exec.rb Updated path construction to use dynamic architecture with null safety
chef-powershell/ext/chef-powershell/extconf.rb Modified DLL search paths and log messages to use dynamic architecture
Rakefile Updated rake task to use dynamic architecture for target directory
.github/workflows/manual-gem-build.yml Added dynamic architecture detection in PowerShell workflow
.github/workflows/gem-build.yml Added dynamic architecture detection in PowerShell workflow
.expeditor/manual_gem_release.ps1 Updated release script to use dynamic architecture
.expeditor/build_gems.ps1 Updated build script to use dynamic architecture
chef-powershell/chef_dictionary.txt Added new dictionary entries (unrelated to architecture changes)

@tpowell-progress tpowell-progress changed the title Caught a problem with hardcoded arch Don't use hardcoded AMD64 architecture for paths Oct 31, 2025
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
@johnmccrae
johnmccrae merged commit 234b838 into 18-Stable Oct 31, 2025
2 of 3 checks passed
johnmccrae added a commit that referenced this pull request Sep 2, 2026
Cherry-picked build-script portion of 18-Stable commit 234b838 (#350):
- build_gems.ps1 / manual_gem_release.ps1 resolve PROCESSOR_ARCHITECTURE
  dynamically instead of hardcoding AMD64
- update_version.ps1 resolves project root via 'git rev-parse
  --show-toplevel' instead of a full C:\ recursive scan

The Ruby runtime portion of 234b838 is not included since main's
ChefPowerShell.bin_dir already supersedes it.

Signed-off-by: John McCrae <mccrae@progress.com>
johnmccrae added a commit that referenced this pull request Sep 4, 2026
Cherry-picked build-script portion of 18-Stable commit 234b838 (#350):
- build_gems.ps1 / manual_gem_release.ps1 resolve PROCESSOR_ARCHITECTURE
  dynamically instead of hardcoding AMD64
- update_version.ps1 resolves project root via 'git rev-parse
  --show-toplevel' instead of a full C:\ recursive scan

The Ruby runtime portion of 234b838 is not included since main's
ChefPowerShell.bin_dir already supersedes it.

Signed-off-by: John McCrae <mccrae@progress.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants